(function() {

    angular.module('BlurAdmin.pages.console')
        .controller('consoleUserCtrl', consoleUserCtrl);

    function consoleUserCtrl($scope, $http, $myconfig) {

        $scope.Search = function(val) { //点击搜索
            var opt = { dev_name: '' };
            $scope.tpo = val;
            opt.dev_name = val ? val : (delete opt.dev_name);
            !val && delete opt.dev_name;
            $http.get($myconfig.api.Physicallogs_first_thirty, { params: opt }).then(function(res) {
                var o = 'assets/img/app/herd.png';

                for (var i = 0; i < res.data.data.length; i++) {
                    if (res.data.data[i].headimgurl) {
                        res.data.data[i].headimgurl = res.data.data[i].headimgurl.length > 3 ? ($myconfig.api.Qiniu_url + res.data.data[i].headimgurl) : (res.data.data[i].wxheadimgurl ? res.data.data[i].wxheadimgurl : o);
                    } else {
                        res.data.data[i].headimgurl = res.data.data[i].wxheadimgurl ? res.data.data[i].wxheadimgurl : o;
                    }
                }
                $scope.suer_data = res.data.data;
            })
        }
        $scope.Search(false)

    }

})();